<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<title>rapid-DEV.net Jquery Ajax JSON Cross Domain Example</title>
</head>
<script>

 jQuery(document).ready(function(){

  jQuery("#btn").click(function(){

   var dataString = "Name=" + jQuery("#txtName").val() + "&&Message=" + jQuery("#txtMessage").val();
      var url = "http://localhost/FB/iquery2.php?" + dataString;

    $.getJSON(url + "&jsoncallback=?", function(data){
    Name = data.Name;
    Message = data.Message;

    if(Name != "" && Message != "")
    {
     jQuery("#td_msg").html("Hello " + Name + ", you typed: " + Message);
    }
    else
    {
     jQuery("#td_msg").html("Please enter Name and Message to get the result!!!");
    }

   })

   return false;

  });
 });
</script>
<body>
<table cellspacing="0" cellpadding="2" border="0" width="30%" align="center">
<tbody>
 <tr><td colspan="2" style="color:red" id="td_msg"></td></tr>
 <tr><td colspan="2"><h3>Jquery Ajax JSON Cross Domain Example</h3></td></tr>
 <tr>
  <td align="left">Your name: </td>
  <td align="left"><input type="text" name="txtName" id="txtName"/></td>
 </tr>
 <tr>
  <td align="left">Type something: </td>
  <td align="left"><input type="text" name="txtMessage" id="txtMessage" /></td>
 </tr>
 <tr>
  <td></td>
  <td align="left"><input type="button" id="btn" name="btn" value="Submit" /></td>
 </tr>
</tbody>
</table>
</body>
</html>
